import request from '../utils/request'
/* 文章分类列表函数 */
export const catelistApi = (catelistApi) => {
  return request({
    url: '/my/cate/list',
    method: 'get'
  })
}

// 添加分类函数
export const addcateApi = (addcateApi) => {
  return request({
    url: '/my/cate/add',
    method: 'post',
    data: addcateApi
  })
}

// 删除文章分类函数
export const delcateApi = (delcateApi) => {
  return request({
    url: '/my/cate/del',
    method: 'DELETE',
    params: { id: delcateApi }
  })
}

// 编辑文章分类函数
export const editcateApi = (editcateApi) => {
  return request({
    url: '/my/cate/info',
    method: 'get',
    params: { id: editcateApi }
  })
}

// 更新文章分类函数
export const updatecateApi = (updatecateApi) => {
  return request({
    url: '/my/cate/info',
    method: 'PUT',
    data: updatecateApi
  })
}

// 文章类别
// 获取文章分类
export const getArtlistApi = (q) => {
  return request({
    url: '/my/article/list',
    method: 'get',
    params: q
  })
}

// 根据id获取详情数据
export const getArtInfo = (id) => {
  return request({
    url: '/my/article/info',
    method: 'get',
    params: { id }
  })
}

// 根据id删除文章
export const delArtlist = (id) => {
  return request({
    url: '/my/article/info',
    method: 'DELETE',
    params: { id }
  })
}

// 发送发布文章请求
export const pubArtlist = (obj) => {
  return request({
    url: '/my/article/add',
    method: 'post',
    data: obj
  })
}
